package cn.edu.ustc.xrovers.action;

import cn.edu.ustc.xrovers.model.BalanceSheet;
import cn.edu.ustc.xrovers.model.CashFlowStatement;
import cn.edu.ustc.xrovers.model.IncomeStatement;
import cn.edu.ustc.xrovers.model.Loan;
import cn.edu.ustc.xrovers.model.NonFinancialInformation;
import cn.edu.ustc.xrovers.service.HandleCompanyInfoService;

import com.opensymphony.xwork2.ActionSupport;

public class ReportAction extends ActionSupport{

	private String loanId;
	private BalanceSheet bs;
	private CashFlowStatement cfs;
	private IncomeStatement is;
	private NonFinancialInformation nfi;
	private Loan loan;
	private HandleCompanyInfoService hci;
	
	/**
	 * 查找报表信息方法
	 * @return "success"
	 * @throws Exception
	 */
	public String findReport() throws Exception {
		bs=(BalanceSheet) hci.findReport("BalanceSheet", loanId);
		cfs=(CashFlowStatement) hci.findReport("CashFlowStatement", loanId);
		is=(IncomeStatement) hci.findReport("IncomeStatement", loanId);
		nfi=(NonFinancialInformation) hci.findReport("NonFinancialInformation", loanId);
		loan=(Loan)hci.findLoanInfo(loanId);
		return SUCCESS;
	}
	
	/**
	 * 更新报表信息方法
	 * @return "success"
	 * @throws Exception
	 */
	public String updateReport() throws Exception {
		hci.updateInfo(bs);
		hci.updateInfo(cfs);
		hci.updateInfo(is);
		hci.updateInfo(nfi);
		hci.updateInfo(loan);
		return SUCCESS;
	}
	
	
	/*getset方法*/
	public String getLoanId() {
		return loanId;
	}
	public void setLoanId(String loanId) {
		this.loanId = loanId;
	}
	public void setHci(HandleCompanyInfoService hci) {
		this.hci = hci;
	}
	public HandleCompanyInfoService getHci() {
		return hci;
	}
	public void setBs(BalanceSheet bs) {
		this.bs = bs;
	}
	public BalanceSheet getBs() {
		return bs;
	}
	public void setCfs(CashFlowStatement cfs) {
		this.cfs = cfs;
	}
	public CashFlowStatement getCfs() {
		return cfs;
	}
	public void setIs(IncomeStatement is) {
		this.is = is;
	}
	public IncomeStatement getIs() {
		return is;
	}
	public void setNfi(NonFinancialInformation nfi) {
		this.nfi = nfi;
	}
	public NonFinancialInformation getNfi() {
		return nfi;
	}
	public void setLoan(Loan loan) {
		this.loan = loan;
	}
	public Loan getLoan() {
		return loan;
	}
}
